package service

import (
	"hsy/server/dao"
	"hsy/server/model"
	"time"
)

//CategoryService ...
type CategoryService struct {
}

var categoryDao = new(dao.CategoryDao)

//AddCategory ...
func (cs *CategoryService) AddCategory(name, desc string, createID, pID int) int64 {

	var catergory = new(model.Category)
	catergory.CategoryName = name
	catergory.CategoryDesc = desc
	catergory.CreatedBy = createID
	catergory.UpdatedBy = createID
	catergory.PID = pID
	catergory.CreatedTime = time.Now()
	catergory.UpdatedTime = time.Now()

	return categoryDao.Add(catergory)
}
